package com.example.springbootdemo.user;

import com.example.springbootdemo.validate.AddGroup;
import com.example.springbootdemo.validate.UpdateGroup;
import com.example.springbootdemo.validate.ValidEmail;
import com.example.springbootdemo.validate.ValidPhone;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
@Data
@ValidPhone(groups = AddGroup.class)
public class UserCmd {

    @NotEmpty(message = "id cannot be null",groups = UpdateGroup.class)
    private String id;

    @NotEmpty(message = "Name cannot be null", groups = AddGroup.class)
    @Size(min = 2, message = "Name must have at least 2 characters")
    private String name;

    @NotEmpty(groups = AddGroup.class, message = "密码不能为空")
    @Size(min = 8, max = 20, message = "Password must be between 8 to 20 characters")
    private String password;

    @NotEmpty(groups = AddGroup.class, message = "国家不能为空")
    private String country;

    @NotEmpty(groups = AddGroup.class, message = "email不能为空")
    @ValidEmail(groups = AddGroup.class)
    private String email;

    private String phone;

    // Getters and Setters
}